
***Replication do-file of supplementary appendix: Adapt or perish
***Author: Marc van de Wardt
***E-mail: M.vdWardt@uvt.nl
***Date: 1-3-2019
***Notes: Figure A3 and A4 are replicated in the "replicate pss measure.do" do-file. We refrain from replicating Figure A2, as this would require sharing Clark & Golder's (2006) data. However, we can provide the do-file to create this figure upon request.  
***Notes: to obtain model fit indices after firthlogit analyses, you need to install the user-written package firthfit

ssc install firthfit

log using "YOUR LOCATION\supplementary appendix.smcl", replace

use "YOUR LOCATION\replication data.dta", clear

set more off

gen yline=0

***Description of variables used for analyses presented in manuscript
label var country "Country name"
label var ccode "Country code"
label var elec_year "Election year (Parlgov.org)"
label var elec_month "Election month (Parlgov.org)"
label var party_id "Party identifier (Parlgov.org)"
label var party_name_english "Party name (Parlgov.org)"
label var index "Election counter"
label var pss "Party system saturation t (Based on residuals of Model 2, Table 2 of van de Wardt(2017)"
label var nicheness "Nicheness of party program t (Formula after Meyer and Wagner (2013) but based on issue classification scheme of Stoll (2011), https://homepage.univie.ac.at/markus.wagner/Meyer_Wagner_CPS_suppmat.pdf"
label var niche_party_previous "Niche party program at t-1 (Formula after Meyer and Wagner (2013) but based on issue classification scheme of Stoll (2011), https://homepage.univie.ac.at/markus.wagner/Meyer_Wagner_CPS_suppmat.pdf"
label var niche_party "Niche party program at t (Formula after Meyer and Wagner (2013) but based on issue classification scheme of Stoll (2011), https://homepage.univie.ac.at/markus.wagner/Meyer_Wagner_CPS_suppmat.pdf"
label var vote_loss "Vote loss between t-1 and t-2 (data from Parlgov.org)"
label var vote_share "Vote share obtained in election t (Parlgov.org)"
label var party_age "Party age (based on party founding data from Parlgov.org)"
label var opposition "Opposition/government status resulting from election t (Parlgov.org)"
label var lopposition "Opposition/government status resulting from  election t-1 (based on data from Parlgov.org)"
label var leaderdom "Dominance of party leadership (Giger and Schumacher 2015)" 
label var inalliance "In alliance t (Parlgov.org)"
label var linalliance "In alliance t-1 (based on data from Parlgov.org)"
label var advantager "Advantage ratio resulting from election t (based on data from Parlgov.org)"
label var lr_extremity  "Extremity of left-right position t (based on Rile score of Comparative Manifesto Project"
label var norepres "No parliamentary representation gained in election t-1 (based on data from Parlgov.org plus additional data collected by author)"
label var norepres2 "No parliamentary representation gained in election t (based on data from Parlgov.org plus additional data collected by author)"
label var office_exp "Experience in government including result of election t (based on data from Parlgov.org)"
label var alliance_exp "Alliance experience including result of election t (based on data from Parlgov.org)"
label var totparlparties "Total number of parliamentary parties resulting from election t (based on data from Parlgov.org)"
label var merger "Party merges after election t (based on data from Parlgov.org plus additional data collected by own research assistant)"
label var reg_cost "Registration costs t (Tavits 2006)"
label var party_fin "Party financing t (Tavits 2006)"
label var ln_petit "Petition (logged) t (Tavits 2006)"
label var decade "Decade of election"
label var elec_year_parl2 "Last election observed in the dataset by country"

***Description of additional variables used for analyses presented in supplementary appendix
label var pss_mod3 "Party system saturation t (Based on residuals from Model 3, Table 2 of van de Wardt(2017)"
label var pss_cg "Party system saturation t (based on residuals from Table 2, Model established democracies of Clark and Golder (2006)"
label var cdiv "Cultural fractionalization t (Fearon 2003)"
label var LogMedian "Logged Median District Magnitude t (Carey and Hix 2011 with own additions for recent elections)"
label var nicheness_bischof "Nicheness of party program t (Bischof 2017)"
label var nicheness_meymil "Nicheness of party program t (Formula after Meyer & Miller (2013) but based on issue classification scheme of Stoll (2011))"
label var niche_party_previous_meymill "Niche party program at t-1 (1 if party was one sd above the mean score of its competitors on nicheness_meymil at t-1)"
label var niche_party_previous_bischof "Niche party program at t-1 (1 if party was one sd above the mean score of its competitors on nicheness_bischof at t-1)"
label var nicheness_previous "Nicheness compared to competitors' programs at t-1"
label var morecohesiveshiftdummy "Shift towards clearer platform (Lo et al 2016)"
label var niche_party_meguid "Niche party t (based on party family data from Parlgov.org)"
label var enep "Effective number of electoral parties t (Bormann and Golder 2013, Version 2.0)"

tsset party_id index


**Replicate Table A1

preserve

drop if pss==.

keep nicheness inalliance merger pss party_age leaderdom vote_share advantager office_exp alliance_exp lr_extremity totparlparties reg_cost  ln_petit vote_loss opposition norepres party_fin niche_party

capture outreg2 using "YOUR LOCATION\TableA1.xls", replace dec(3) sum(log) keep(nicheness inalliance merger pss party_age leaderdom vote_share advantager office_exp alliance_exp lr_extremity totparlparties reg_cost  ln_petit vote_loss opposition norepres party_fin niche_party)

restore

**Replicate Table A3

preserve

drop if pss==.

keep if merger==1
keep pss party_age norepres2 opposition office_exp alliance_exp vote_share
capture outreg2 using "YOUR LOCATION\TableA3.xls", replace dec(3) sum(log) keep(pss party_age norepres2 opposition office_exp alliance_exp vote_share)

restore

**Replicate Table A4 & Figure A1

xtmelogit inalliance c.l.pss##c.party_age norepres lopposition l.office_exp l.alliance_exp l.totparlparties if linalliance==1 || ccode:, var
est store mod1

margins, dydx(L.pss) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

xtmelogit inalliance c.l.pss##c.leaderdom norepres lopposition l.office_exp l.alliance_exp l.totparlparties party_age if linalliance==1 || ccode:, var
est store mod2

margins, dydx(L.pss) at(leaderdom=(0(1)30)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 30 31

twoway hist leaderdom if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Leader dominance",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

xtmelogit inalliance c.l.pss##c.l.vote_share norepres lopposition l.office_exp l.alliance_exp l.totparlparties party_age  if linalliance==1 || ccode:, var
est store mod3

margins, dydx(L.pss) at(L.vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

gen lsize=l.vote_share
twoway hist lsize if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size t-1",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(c, replace)

drop xyz- g

xtmelogit inalliance c.l.pss##i.lopposition norepres  l.office_exp l.alliance_exp l.totparlparties party_age  if linalliance==1 || ccode:, var
est store mod4

margins, dydx(L.pss) at(lopposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(d, replace) 

graph combine a b c d, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA1.wmf", replace
capture esttab  mod1 mod2 mod3 mod4,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA4.csv", replace


**Replicate Figure A5

xtmixed nicheness c.l.pss_mod3##i.niche_party_previous vote_loss l.vote_share party_age lopposition i.decade || party_id:, var

margins, dydx(L.pss_mod3) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness c.l.pss_mod3##i.niche_party_previous##c.party_age  vote_loss l.vote_share lopposition i.decade ||  party_id:, var

margins, dydx(L.pss_mod3) at(niche_party_previous=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "party_age=1" 6 "party_age=25" 7 "party_age=50" 8 "party_age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness c.l.pss_mod3##i.niche_party_previous##c.leaderdom  vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss_mod3) at(niche_party_previous=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness c.l.pss_mod3##i.niche_party_previous##c.l.vote_share  vote_loss party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss_mod3) at(niche_party_previous=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness c.l.pss_mod3##i.niche_party_previous##i.lopposition vote_loss party_age l.vote_share i.decade || party_id:, var

margins, dydx(L.pss_mod3) at(niche_party_previous=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA5.wmf", replace

**Replicate Table A6 and Figure A6

xtmelogit inalliance l.pss_mod3 norepres lopposition l.office_exp l.alliance_exp l.totparlparties party_age  if linalliance==1 || ccode:, var
est store mod1

xtmelogit inalliance l.pss_mod3 l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age  if linalliance==0 || ccode:, var
est store mod2

xtmelogit inalliance c.l.pss_mod3##c.party_age l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity  if linalliance==0 || ccode:, var
est store mod3

margins, dydx(L.pss_mod3) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

**xtmelogit cannot estimate equation below
melogit inalliance c.l.pss_mod3##c.leaderdom l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age if linalliance==0 || ccode:
est store mod4

margins, dydx(L.pss_mod3) at(leaderdom=(0(1)30)) l(95) predict(xb)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 30 31

twoway hist leaderdom if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Leader dominance",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

xtmelogit inalliance c.l.pss_mod3##c.l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age if linalliance==0 || ccode:, var
est store mod5

margins, dydx(L.pss_mod3) at(L.vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist lsize if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size t-1",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(c, replace)

drop xyz- g

xtmelogit inalliance c.l.pss_mod3##i.lopposition l.advantager norepres  l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age  if linalliance==0 || ccode:, var
est store mod6

margins, dydx(L.pss_mod3) at(lopposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(d, replace) 

graph combine a b c d , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA6.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5 mod6 ,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA6.csv", replace

**Replicate Table A7 Figure A7

preserve

drop if elec_year==elec_year_parl2

firthlogit merger pss_mod3 party_age advantager norepres2 opposition office_exp alliance_exp lr_extremity reg_cost party_fin ln_petit
tab merger if e(sample)==1
est store mod1
firthfit

firthlogit merger pss_mod3 party_age norepres2 opposition office_exp alliance_exp 
tab merger if e(sample)==1
est store mod2
firthfit

firthlogit merger c.pss_mod3##c.party_age norepres2 opposition office_exp alliance_exp 
tab merger if e(sample)==1
est store mod3
firthfit
margins, dydx(pss_mod3) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g


firthlogit merger c.pss_mod3##c.vote_share party_age norepres2 opposition office_exp alliance_exp 
tab merger if e(sample)==1
est store mod4
firthfit

margins, dydx(pss_mod3) at(vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist vote_share if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

firthlogit merger c.pss_mod3##i.opposition party_age norepres2 office_exp alliance_exp 
tab merger if e(sample)==1
est store mod5
firthfit

margins, dydx(pss_mod3) at(opposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA7.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5 ,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA7.csv", replace

restore


**Replicate Figure A8

xtmixed nicheness c.l.pss_cg##i.niche_party_previous vote_loss l.vote_share party_age lopposition i.decade || party_id:, var

margins, dydx(L.pss_cg) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness c.l.pss_cg##i.niche_party_previous##c.party_age  vote_loss l.vote_share lopposition i.decade ||  party_id:, var

margins, dydx(L.pss_cg) at(niche_party_previous=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "party_age=1" 6 "party_age=25" 7 "party_age=50" 8 "party_age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness c.l.pss_cg##i.niche_party_previous##c.leaderdom  vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss_cg) at(niche_party_previous=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness c.l.pss_cg##i.niche_party_previous##c.l.vote_share  vote_loss party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss_cg) at(niche_party_previous=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness c.l.pss_cg##i.niche_party_previous##i.lopposition vote_loss party_age l.vote_share i.decade || party_id:, var

margins, dydx(L.pss_cg) at(niche_party_previous=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA8.wmf", replace

**Replicate Table A8 and Figure A9

xtmelogit inalliance l.pss_cg norepres lopposition l.office_exp l.alliance_exp l.totparlparties party_age  if linalliance==1 || ccode:, var
est store mod1

xtmelogit inalliance l.pss_cg l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age  if linalliance==0 || ccode:, var
est store mod2

xtmelogit inalliance c.l.pss_cg##c.party_age l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity  if linalliance==0 || ccode:, var
est store mod3

margins, dydx(L.pss_cg) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

**Model 4 could only be estimated in MlWINN, please contact me for the script

xtmelogit inalliance c.l.pss_cg##c.l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age if linalliance==0 || ccode:, var
est store mod5

margins, dydx(L.pss_cg) at(L.vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist lsize if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size t-1",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(c, replace)

drop xyz- g

xtmelogit inalliance c.l.pss_cg##i.lopposition l.advantager norepres  l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age  if linalliance==0 || ccode:, var
est store mod6

margins, dydx(L.pss_cg) at(lopposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(d, replace) 

graph combine a c d , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA9.wmf", replace
capture esttab mod1 mod2 mod3 mod5 mod6 ,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA8.csv", replace

**Replicate Table A9 Figure A10

preserve

drop if elec_year==elec_year_parl2

firthlogit merger pss_cg party_age advantager norepres2 opposition office_exp alliance_exp lr_extremity reg_cost party_fin ln_petit
tab merger if e(sample)==1
est store mod1
firthfit

firthlogit merger pss_cg party_age norepres2 opposition office_exp alliance_exp 
tab merger if e(sample)==1
est store mod2
firthfit

firthlogit merger c.pss_cg##c.party_age norepres2 opposition office_exp alliance_exp 
tab merger if e(sample)==1
est store mod3
firthfit
margins, dydx(pss_cg) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g


firthlogit merger c.pss_cg##c.vote_share party_age norepres2 opposition office_exp alliance_exp 
tab merger if e(sample)==1
est store mod4
firthfit

margins, dydx(pss_cg) at(vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist vote_share if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

firthlogit merger c.pss_cg##i.opposition party_age norepres2 office_exp alliance_exp 
tab merger if e(sample)==1
est store mod5
firthfit

margins, dydx(pss_cg) at(opposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA10.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5 ,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA9.csv", replace

restore


**Replicate Figure A11

xtmixed nicheness c.l.enep##i.niche_party_previous vote_loss l.vote_share party_age lopposition i.decade c.l.LogMedian##c.l.cdiv || party_id:, var

margins, dydx(L.enep) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of ENEP t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness c.l.enep##i.niche_party_previous##c.party_age vote_loss l.vote_share lopposition i.decade c.l.LogMedian##c.l.cdiv || party_id:, var

margins, dydx(L.enep) at(niche_party_previous=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of ENEP t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "party_age=1" 6 "party_age=25" 7 "party_age=50" 8 "party_age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness c.l.enep##i.niche_party_previous##c.leaderdom vote_loss l.vote_share party_age lopposition i.decade c.l.LogMedian##c.l.cdiv || party_id:, var

margins, dydx(L.enep) at(niche_party_previous=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of ENEP t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness c.l.enep##i.niche_party_previous##c.l.vote_share vote_loss party_age lopposition i.decade c.l.LogMedian##c.l.cdiv || party_id:, var

margins, dydx(L.enep) at(niche_party_previous=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of ENEP t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness c.l.enep##i.niche_party_previous##i.lopposition vote_loss party_age l.vote_share i.decade c.l.LogMedian##c.l.cdiv || party_id:, var

margins, dydx(L.enep) at(niche_party_previous=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of ENEP t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA11.wmf", replace

**Replicate Table A10 and Figure A12

xtmelogit inalliance l.enep norepres lopposition l.office_exp l.alliance_exp l.totparlparties party_age c.l.LogMedian##c.l.cdiv if linalliance==1  || ccode: , var 
est store mod1

xtmelogit inalliance l.enep l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age c.l.LogMedian##c.l.cdiv if linalliance==0  || ccode: , var 
est store mod2

xtmelogit inalliance c.l.enep##c.party_age l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity c.l.LogMedian##c.l.cdiv if linalliance==0  || ccode: , var 
est store mod3

margins, dydx(L.enep) at(party_age=(0(1)181)) l(95) 

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of ENEP t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

xtmelogit inalliance c.l.enep##c.leaderdom l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age c.l.LogMedian##c.l.cdiv if linalliance==0  || ccode: , var 
est store mod4

margins, dydx(L.enep) at(leaderdom=(0(1)30)) l(95) 

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 30 31

twoway hist leaderdom if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Leader dominance",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of ENEP t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

xtmelogit inalliance c.l.enep##c.l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age c.l.LogMedian##c.l.cdiv if linalliance==0  || ccode: , var 
est store mod5

margins, dydx(L.enep) at(L.vote_share=(0(1)60)) l(95) 

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist lsize if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size t-1",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of ENEP t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(c, replace)

drop xyz- g

xtmelogit inalliance c.l.enep##i.lopposition l.advantager norepres  l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age c.l.LogMedian##c.l.cdiv if linalliance==0  || ccode: , var 
est store mod6

margins, dydx(L.enep) at(lopposition=(0 1)) l(95) 
mplotoffset,  ///
ytitle("Marg. effect of ENEP t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(d, replace) 

graph combine a b c d, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA12.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5 mod6,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA10.csv", replace

**Replicate Table A11 and Figure A13

preserve

drop if elec_year==elec_year_parl2

firthlogit merger enep party_age advantager norepres2 opposition office_exp alliance_exp lr_extremity reg_cost party_fin ln_petit  c.LogMedian##c.cdiv 
est store mod1
firthfit

firthlogit merger enep party_age norepres2 opposition office_exp alliance_exp c.LogMedian##c.cdiv 
est store mod2
firthfit

firthlogit merger c.enep##c.party_age norepres2 opposition office_exp alliance_exp c.LogMedian##c.cdiv 
est store mod3
firthfit

margins, dydx(enep) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of ENEP", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

firthlogit merger c.enep##c.vote_share party_age norepres2 opposition office_exp alliance_exp  c.LogMedian##c.cdiv 
est store mod4
firthfit

margins, dydx(enep) at(vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist vote_share if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of ENEP", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

firthlogit merger c.enep##i.opposition party_age norepres2 office_exp alliance_exp  c.LogMedian##c.cdiv 
est store mod5
firthfit

margins, dydx(enep) at(opposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of ENEP") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c, altshrink graphregion(fcolor(white)) 
capture graph export  "YOUR LOCATION\FigureA13.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA11.csv", replace

restore


**Replicate Figure A14

xtmixed nicheness_bischof c.l.pss##i.niche_party_previous_bischof vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_bischof=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness_bischof c.l.pss##i.niche_party_previous_bischof##c.party_age vote_loss l.vote_share lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_bischof=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Age=1" 6 "Age=25" 7 "Age=50" 8 "Age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness_bischof c.l.pss##i.niche_party_previous_bischof##c.leaderdom vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_bischof=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness_bischof c.l.pss##i.niche_party_previous_bischof##c.l.vote_share vote_loss party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_bischof=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness_bischof c.l.pss##i.niche_party_previous_bischof##i.lopposition vote_loss party_age l.vote_share i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_bischof=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA14.wmf", replace


**Replicate Figure A15

xtmixed nicheness_meymil c.l.pss##i.niche_party_previous_meymill vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_meymill=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness_meymil c.l.pss##i.niche_party_previous_meymill##c.party_age vote_loss l.vote_share lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_meymill=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Age=1" 6 "Age=25" 7 "Age=50" 8 "Age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness_meymil c.l.pss##i.niche_party_previous_meymill##c.leaderdom vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_meymill=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness_meymil c.l.pss##i.niche_party_previous_meymill##c.l.vote_share vote_loss party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_meymill=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness_meymil c.l.pss##i.niche_party_previous_meymill##i.lopposition vote_loss party_age l.vote_share i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous_meymill=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA15.wmf", replace

*Replicate Table A12 and Figure A16

logit morecohesiveshiftdummy l.d.pss  c.vote_loss l.vote_share party_age lopposition i.decade, cluster(party_id)
est store mod1

reg morecohesiveshiftdummy c.l.d.pss##c.party_age  c.vote_loss l.vote_share lopposition i.decade, cluster(party_id)
est store mod2
margins, dydx(L.d.pss) at(party_age=(1(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 1 181 181

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation increase t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

reg morecohesiveshiftdummy c.l.d.pss##c.leaderdom party_age  c.vote_loss l.vote_share lopposition i.decade, cluster(party_id)
est store mod3

margins, dydx(L.d.pss) at(leaderdom=(0(1)30)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 30 31

twoway hist leaderdom if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Leader dominance",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation increase t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

reg morecohesiveshiftdummy c.l.d.pss##c.l.vote_share party_age  c.vote_loss  lopposition i.decade, cluster(party_id)
est store mod4

margins, dydx(L.d.pss) at(L.vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist lsize if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size t-1",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation increase t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(c, replace)

drop xyz- g

reg morecohesiveshiftdummy c.l.d.pss##i.lopposition l.vote_share party_age  c.vote_loss  i.decade, cluster(party_id)
est store mod5

margins, dydx(L.d.pss) at(lopposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation increase t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(d, replace) 


graph combine a b c d, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA16.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5,  stats(r2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA12.csv", replace

**Replicate Figure A17

xtmixed nicheness_previous c.l.pss##i.niche_party_previous vote_loss l.vote_share party_age lopposition i.decade || party_id:, var

margins, dydx(L.pss) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness_previous c.l.pss##i.niche_party_previous##c.party_age  vote_loss l.vote_share lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "party_age=1" 6 "party_age=25" 7 "party_age=50" 8 "party_age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness_previous c.l.pss##i.niche_party_previous##c.leaderdom  vote_loss l.vote_share party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness_previous c.l.pss##i.niche_party_previous##c.l.vote_share  vote_loss party_age lopposition i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_previous=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness_previous c.l.pss##i.niche_party_previous##i.lopposition vote_loss party_age l.vote_share i.decade || party_id:, var

margins, dydx(L.pss) at(niche_party_previous=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA17.wmf", replace

**Replicate Figure A18

xtmelogit inalliance c.l.pss##c.l.lr_extremity l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age  if linalliance==0  || ccode:, var 

margins, dydx(L.pss) at(l.lr_extremity=(0(0.1)22)) l(95)
gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 22 221

gen llr_extremity=l.lr_extremity
twoway hist llr_extremity if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Left-right extremity t-1" "Coefficient on interaction term is -.078 (se=.044)",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off) title(Van de Wardt (2017): Model 2)  graphregion(color(white)) name(a, replace)

drop xyz- g

xtmelogit inalliance c.l.pss_mod3##c.l.lr_extremity l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties party_age  if linalliance==0  || ccode:, var 

margins, dydx(L.pss_mod3) at(l.lr_extremity=(0(0.1)22)) l(95)
gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 22 221

twoway hist llr_extremity if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Left-right extremity t-1" "Coefficient on interaction term is -.085 (se=.101)",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1" , size(medsmall) axis(1)) ///
legend(off) title(Van de Wardt (2017): Model 3)  graphregion(color(white)) name(b, replace)

drop xyz- g

xtmelogit inalliance c.l.pss_cg##c.l.lr_extremity l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties party_age  if linalliance==0  || ccode:, var 

margins, dydx(L.pss_cg) at(l.lr_extremity=(0(0.1)22)) l(95)
gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 22 221

twoway hist llr_extremity if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Left-right extremity t-1" "Coefficient on interaction term is -.054 (se=.048)",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off) title(Clark & Golder (2006))   graphregion(color(white)) name(c, replace)

drop xyz- g

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA18.wmf", replace

**Replicate Figure A19

xtmixed nicheness c.l.pss##i.niche_party_meguid vote_loss party_age l.vote_share i.decade ||  party_id:, var

margins, dydx(L.pss) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is -.282(se=.253)") ///
title(Van de Wardt (2017): Model 2) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness c.l.pss_mod3##i.niche_party_meguid vote_loss party_age l.vote_share i.decade ||  party_id:, var

margins, dydx(L.pss_mod3) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is -.133(se=.237)") ///
title(Van de Wardt (2017): Model 3) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness c.l.pss_cg##i.niche_party_meguid vote_loss party_age l.vote_share i.decade ||  party_id:,  var
margins, dydx(L.pss_cg) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is .036(se=.403)") ///
title(Clark & Golder (2006)) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA19.wmf", replace

**Replicate Figure A20

xtmelogit inalliance c.l.pss##i.niche_party_meguid l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age  if linalliance==0  || ccode:, var

margins, dydx(L.pss) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is -.348 (se=.176)") ///
title(Van de Wardt (2017): Model 2) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmelogit inalliance c.l.pss_mod3##i.niche_party_meguid l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age  if linalliance==0  || ccode:, var 

margins, dydx(L.pss_mod3) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is -.849 (se=.364)") ///
title(Van de Wardt (2017): Model 3) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(b, replace) 

xtmelogit inalliance c.l.pss_cg##i.niche_party_meguid l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age  if linalliance==0  || ccode:, var  

margins, dydx(L.pss_cg) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is -.362 (se=.229)") ///
title(Clark & Golder (2006)) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA20.wmf", replace

**Replicate Figure A21

preserve

drop if elec_year==elec_year_parl2

firthlogit merger c.pss##i.niche_party_meguid party_age norepres2 office_exp alliance_exp 

margins, dydx(pss) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("Coefficient on interaction term is -.314 (se=.243)") ///
title(Van de Wardt (2017): Model 2) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

firthlogit merger c.pss_mod3##i.niche_party_meguid party_age norepres2 office_exp alliance_exp 

margins, dydx(pss_mod3) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("Coefficient on interaction term is -.234 (se=.287)") ///
title(Van de Wardt (2017): Model 3) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(b, replace) 

firthlogit merger c.pss_cg##i.niche_party_meguid party_age norepres2 office_exp alliance_exp 

margins, dydx(pss_cg) at(niche_party_meguid=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("Coefficient on interaction term is -.186 (se=.288)") ///
title(Clark & Golder (2006)) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

restore

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA21.wmf", replace

**Replicate Figure A22 

xtmelogit inalliance c.l.pss##i.niche_party_previous l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age   if linalliance==0  || ccode:, var

margins, dydx(L.pss) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is -.292 (se=.294)") ///
title(Van de Wardt (2017): Model 2) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmelogit inalliance c.l.pss_mod3##i.niche_party_previous l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age   if linalliance==0  || ccode:, var

margins, dydx(L.pss_mod3) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is .147 (se=1.084)") ///
title(Van de Wardt (2017): Model 3) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(b, replace) 

xtmelogit inalliance c.l.pss_cg##i.niche_party_previous l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties  party_age   if linalliance==0  || ccode:, var

margins, dydx(L.pss_cg) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("Coefficient on interaction term is .047 (se=.309)") ///
title(Clark & Golder (2006)) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA22.wmf", replace

**Replicate Figure A23 

preserve

drop if elec_year==elec_year_parl2

firthlogit merger c.pss##i.niche_party party_age  norepres2 office_exp alliance_exp 

margins, dydx(pss) at(niche_party=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("Coefficient on interaction term is -.066 (se=.351)") ///
title(Van de Wardt (2017): Model 2) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

firthlogit merger c.pss_mod3##i.niche_party party_age  norepres2 office_exp alliance_exp 

margins, dydx(pss_mod3) at(niche_party=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("Coefficient on interaction term is -.240 (se=.412)") ///
title(Van de Wardt (2017): Model 3) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(b, replace) 

firthlogit merger c.pss_cg##i.niche_party party_age  norepres2 office_exp alliance_exp 

margins, dydx(pss_cg) at(niche_party=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("Coefficient on interaction term is .290 (se=.338)") ///
title(Clark & Golder (2006)) ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

restore

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA23.wmf", replace

**Replicate Table A13 and Figure A24

preserve

drop if elec_year==elec_year_parl2

firthlogit merger pss party_age advantager norepres2 opposition office_exp alliance_exp lr_extremity reg_cost party_fin ln_petit niche_party_meguid
est store mod1
firthfit

firthlogit merger pss party_age norepres2 opposition office_exp alliance_exp  niche_party_meguid
est store mod2
firthfit

firthlogit merger c.pss##c.party_age norepres2 opposition office_exp alliance_exp niche_party_meguid 
est store mod3
firthfit

margins, dydx(pss) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

firthlogit merger c.pss##c.vote_share party_age norepres2 opposition office_exp alliance_exp niche_party_meguid 
est store mod4
firthfit

margins, dydx(pss) at(vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist vote_share if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

firthlogit merger c.pss##i.opposition party_age norepres2 office_exp alliance_exp niche_party_meguid
est store mod5
firthfit

margins, dydx(pss) at(opposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA24.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA13.csv", replace

restore

**Replicate Table A14 and Figure A25

preserve

drop if elec_year==elec_year_parl2

firthlogit merger pss party_age advantager norepres2 opposition office_exp alliance_exp lr_extremity reg_cost party_fin ln_petit niche_party
est store mod1
firthfit

firthlogit merger pss party_age norepres2 opposition office_exp alliance_exp  niche_party
est store mod2
firthfit

firthlogit merger c.pss##c.party_age norepres2 opposition office_exp alliance_exp niche_party
est store mod3
firthfit

margins, dydx(pss) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

firthlogit merger c.pss##c.vote_share party_age norepres2 opposition office_exp alliance_exp niche_party
est store mod4
firthfit

margins, dydx(pss) at(vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist vote_share if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

firthlogit merger c.pss##i.opposition party_age norepres2 office_exp alliance_exp niche_party
est store mod5
firthfit

margins, dydx(pss) at(opposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA25.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA14.csv", replace

restore

**Replicate Table A15 and Figure A26

xtmixed nicheness c.l.pss##i.niche_party_previous vote_loss l.vote_share party_age lopposition i.decade || ccode: || party_id:, var
est store mod1

margins, dydx(L.pss) at(niche_party_previous=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(a, replace) 

xtmixed nicheness c.l.pss##i.niche_party_previous##c.party_age  vote_loss l.vote_share lopposition i.decade || ccode: ||  party_id:, var
est store mod2

margins, dydx(L.pss) at(niche_party_previous=(0 1) party_age=(1 25 50 75)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "party_age=1" 6 "party_age=25" 7 "party_age=50" 8 "party_age=75")) ///
graphregion(fcolor(white)) name(b, replace) 

xtmixed nicheness c.l.pss##i.niche_party_previous##c.leaderdom  vote_loss l.vote_share party_age lopposition i.decade || ccode: ||  party_id:, var
est store mod3

margins, dydx(L.pss) at(niche_party_previous=(0 1) leaderdom=(0 10 20 30)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Lead. dom.=0" 6 "Lead. dom.=10" 7 "Lead. dom.=20" 8 "Lead. dom.=30")) ///
graphregion(fcolor(white)) name(c, replace) 

xtmixed nicheness c.l.pss##i.niche_party_previous##c.l.vote_share  vote_loss party_age lopposition i.decade || ccode: ||  party_id:, var
est store mod4

margins, dydx(L.pss) at(niche_party_previous=(0 1) L.vote_share=(0 10 30 50)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs4)) ///
plot3opts(lcolor(none) msymbol(D) msize(large) mcolor(gs8)) ///
plot4opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13))  ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs4) lwidth(medthick) msize(medlarge)) ///
ci3opts(color(gs8) lwidth(medthick) msize(medlarge)) ///
ci4opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(5 "Size t-1=0" 6 "Size t-1=10" 7 "Size t-1=30" 8 "Size t-1=50")) ///
graphregion(fcolor(white)) name(d, replace) 

xtmixed nicheness c.l.pss##i.niche_party_previous##i.lopposition vote_loss party_age l.vote_share i.decade || ccode: || party_id:, var
est store mod5

margins, dydx(L.pss) at(niche_party_previous=(0 1) lopposition=(0 1)) l(95)
mplotoffset, xtitle("") ///
 ytitle("Marg. effect of party sys. saturation t-1") title("")  ///
scheme(Tufte) ///
plot1opts(lcolor(none) msymbol(D) msize(large) mcolor(black)) ///
plot2opts(lcolor(none) msymbol(D) msize(large) mcolor(gs13)) ///
ci1opts(color(black) lwidth(medthick) msize(medlarge)) ///
ci2opts(color(gs13) lwidth(medthick) msize(medlarge)) ///
yline(0, lcolor(black)) ///
allx ///
legend(order(3 "Government t-1" 4 "Opposition t-1")) ///
graphregion(fcolor(white)) name(e, replace) 

graph combine a b c d e, altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA26.wmf", replace
capture esttab  mod1 mod2 mod3 mod4 mod5,  stats(r2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA15.csv", replace

**Replicate Table A16 and Figure A27

xtmelogit inalliance l.pss norepres lopposition l.office_exp l.alliance_exp l.totparlparties party_age  if linalliance==1   || ccode: || party_id:, var
est store mod1

xtmelogit inalliance l.pss l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age  if linalliance==0 || ccode: || party_id:, var
est store mod2

xtmelogit inalliance c.l.pss##c.party_age l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity  if linalliance==0  || ccode: || party_id:, var
est store mod3

margins, dydx(L.pss) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

xtmelogit inalliance c.l.pss##c.leaderdom l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age if linalliance==0  || ccode: || party_id:, var 
est store mod4

margins, dydx(L.pss) at(leaderdom=(0(1)30)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 30 31

twoway hist leaderdom if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Leader dominance",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

xtmelogit inalliance c.l.pss##c.l.vote_share l.advantager norepres lopposition l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age if linalliance==0  || ccode: || party_id:, var
est store mod5

margins, dydx(L.pss) at(L.vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist lsize if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size t-1",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation t-1", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(c, replace)

drop xyz- g

xtmelogit inalliance c.l.pss##i.lopposition l.advantager norepres  l.office_exp  l.alliance_exp l.totparlparties l.lr_extremity party_age  if linalliance==0  || ccode: || party_id:, var
est store mod6

margins, dydx(L.pss) at(lopposition=(0 1)) l(95)
mplotoffset,  ///
ytitle("Marg. effect of party system saturation t-1") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(d, replace) 

graph combine a b c d , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA27.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5 mod6 ,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA16.csv", replace

**Replicate Table A17 and Figure A28

preserve

drop if elec_year==elec_year_parl2

xtmelogit merger pss party_age advantager norepres2 opposition office_exp alliance_exp lr_extremity reg_cost party_fin ln_petit || ccode: || party_id:, var
est store mod1

xtmelogit  merger pss party_age norepres2 opposition office_exp alliance_exp   || ccode: || party_id:, 
est store mod2

xtmelogit  merger c.pss##c.party_age norepres2 opposition office_exp alliance_exp  || ccode: || party_id:, var
est store mod3

margins, dydx(pss) at(party_age=(0(1)181)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 181 182

twoway hist party_age if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party age",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(a, replace)

drop xyz- g

xtmelogit  merger c.pss##c.vote_share party_age norepres2 opposition office_exp alliance_exp  || ccode: || party_id:, var 
est store mod4

margins, dydx(pss) at(vote_share=(0(1)60)) l(95)

gen xyz=1 if e(sample)==1
matrix y_=r(table)'
svmat y_
range g 0 60 61

twoway hist vote_share if xyz==1, percent bcolor(gs15) yaxis(2)  ///
|| line y_5 y_6 g,  lcolor(black) lpattern(dash dash)  ///
|| line y_1 g, lcolor(black) ///
|| line yline g, lcolor(black) ///
,  xtitle("Party size",  size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Marg. effect of party system saturation", size(medsmall) axis(1)) ///
legend(off)  graphregion(color(white)) name(b, replace)

drop xyz- g

xtmelogit  merger c.pss##i.opposition party_age norepres2 office_exp alliance_exp  || ccode: || party_id:, var  
est store mod5

margins, dydx(pss) at(opposition=(0 1)) l(95)
marginsplot,  ///
ytitle("Marg. effect of party system saturation") ///
xtitle("") ///
title("") ///
scheme(Tufte) ///
ci1opts(color(gs1) lwidth(medthick) msize(medlarge)) ///
plot1opts(lcolor(none) msymbol(D) mcolor(black) msize(large)) ///
yline(0, lcolor(black)) ///
allx ///
graphregion(fcolor(white)) name(c, replace) 

graph combine a b c , altshrink graphregion(fcolor(white)) 
capture graph export "YOUR LOCATION\FigureA28.wmf", replace
capture esttab mod1 mod2 mod3 mod4 mod5 ,  stats(pr2 bic N)  starlevels(* 0.1 ** 0.05 *** 0.01) b(3) se(3) , using "YOUR LOCATION\TableA17.csv", replace

restore

**Replicate case selection (Section 5)

preserve

bys party_id elec_year: gen totelec=_N
replace elec_month=. if totelec==1

sort party_id index

keep  country party_id party_name_english elec_year elec_month index
reshape wide elec_year elec_month, i(party_id) j(index)

order party_name, b(elec_year1)

sort country elec_year1
order country, b(party_name)

foreach x of numlist 1/26 {
egen elect`x'=concat(elec_year`x' elec_month`x'),  punct("-")
replace elect`x'=subinstr(elect`x', "-.", "",.)
replace elect`x'=subinstr(elect`x', ".", "",.)
}

egen elecs=concat(elect*),  punct(" ")
leftalign elecs

keep party_id country party_name_english elecs
order country, b(party_id)
sort country party_name

capture export excel using "YOUR LOCATION\case selection.xlsx", replace firstrow(variables)

restore

log close
